package com.example.communitypro.controller;

import com.example.communitypro.pojo.SystemSetting;
import com.example.communitypro.service.SystemServiceImpl;
import com.example.communitypro.util.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/system")
public class SystemController {

    @Autowired
    private SystemServiceImpl systemService;

    @RequestMapping(value="/findSystem")
    @ResponseBody
    @CrossOrigin
    public SystemSetting findSystem(ModelMap map) {
        return systemService.find();
       /* map.put("siteName",systemSetting.getSiteName());
        map.put("siteUrl",systemSetting.getSiteUrl());
        map.put("title",systemSetting.getTitle());
        map.put("copyright",systemSetting.getCopyright());*/
    }

    @RequestMapping(value="/updateSystem")
    @ResponseBody
    @CrossOrigin
    public String updateSystem(SystemSetting systemSetting){
        systemSetting.setNo("1");
        return systemService.updateSystem(systemSetting);
    }
}
